<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>HTML 5 CANVAS游戏开发实战_1.6.3 继承示例Demo</title>
	</head>
	<body>
		<p>输出内容请查看控制台输出。</p>
		<p>内容：使用apply方法将父对象的构造函数绑定到子对象。</p>
		<p>练习目标：子类继承父类的属性。</p>
		<script type="text/javascript">
			function PersonClass(){
				this.type = "人";
			}
			
			PersonClass.prototype = {
				getType:function(){
					console.log("这是PersonClass类的获取属性方法");
				}
			}
			
			function StudentClass(name,age){
				PersonClass.apply(this,arguments);   //关键操作
				this.name = name;
				this.age  = age;
			}
			
			//函数(类)调用
			var stu = new StudentClass("李广",35);
			console.log(stu.type);
		</script>
	</body>
</html>